package com.zachary.es.hadoop.map;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.apache.hadoop.io.MapWritable;
import org.apache.hadoop.io.Text;
import org.apache.hadoop.mapreduce.Mapper;

import java.io.IOException;

/**
 * <pre>
 * Created with IntelliJ IDEA.
 * User: zachary.
 * Date: 2014/7/15
 * Time: 15:20
 * PC：windows'IDEA in company <br>
 * </pre>
 *
 * @author zachary.
 */
public class SearchMapper extends Mapper<Text, MapWritable, Text, Text> {

    /**
     * 日志记录
     */
    private static Log log = LogFactory.getLog(SearchMapper.class);

    @Override
    protected void map(Text key, MapWritable value, Context context) throws IOException, InterruptedException {
        log.info("key==============" + key);
        log.info("value===========" + value);
        System.out.println("key******************" + key);
        System.out.println("value******************" + value);
        context.write(key, new Text(value.toString()));
    }

    @Override
    protected void cleanup(Context context) throws IOException, InterruptedException {
        super.cleanup(context);
    }

    @Override
    protected void setup(Context context) throws IOException, InterruptedException {
        super.setup(context);
    }
}
